import request from '@/utils/request'
import type { IsPushVideoItem, EditSDetail, VideoInfoResult, KeyResult } from './types'

/** 上传素材接口 */
class APIUploadMaterial {
    /** 获取 token，并且开始切片上传 */
    static getToken() {
        return request<any, any>({
            url: '/video/token',
            method: 'POST'
        })
    }

    /** 获取 token，并且开始切片上传 */
    static getVideoToken() {
        return request<any, any>({
            url: '/video/token',
            method: 'POST'
        })
    }

    static getIsPushVideo() {
        return request<any, ResponseData<IsPushVideoItem[]>>({
            url: '/getIsPushVideo',
            method: 'POST'
        })
    }

    static getEditSDetail(goods_id: number) {
        return request<any, ResponseData<any>>({
            url: '/getEditSDetail',
            method: 'POST',
            data: { goods_id }
        })
    }

    static changeVideo(data: any) {
        return request<any, any>({
            url: '/changeVideo',
            method: 'POST',
            data
        })
    }

    static videoInfo(code: string) {
        return request<any, ResponseData<VideoInfoResult>>({
            url: '/video/info',
            method: 'POST',
            data: { code }
        })
    }

    static delVideo(goods_id: number) {
        return request<any, ResponseData>({
            url: '/delVideo',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 根据标题生成关键字 */
    static getKey(title: string) {
        return request<any, ResponseData<KeyResult>>({
            url: '/getKey',
            method: 'POST',
            data: { title }
        })
    }

    /** 图片上传获取token */
    static getPicToken(dpi: number) {
        return request<any, ResponseData>({
            url: '/pic/token',
            method: 'POST',
            data: { dpi }
        })
    }

    static getIsPushPic() {
        return request<any, ResponseData<any[]>>({
            url: '/getIsPushPic',
            method: 'POST'
        })
    }

    static picGetEditSDetail(goods_id: number) {
        return request<any, ResponseData>({
            url: '/pic/getEditSDetail',
            method: 'POST',
            data: { goods_id }
        })
    }

    static changePic(data: any) {
        return request<any, ResponseData>({
            url: '/changePic',
            method: 'POST',
            data
        })
    }

    static picInfo(code: string) {
        return request<any, ResponseData>({
            url: '/pic/info',
            method: 'POST',
            data: { code }
        })
    }

    static deletePic(goods_id: number) {
        return request<any, ResponseData>({
            url: '/deletePic',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 上传音乐获取token */
    static musicToken(data: any) {
        return request<any, ResponseData>({
            url: '/music/token',
            method: 'POST',
            data
        })
    }

    /** 获取音乐编辑模块 */
    static getIsPusMusic() {
        return request<any, ResponseData<any[]>>({
            url: '/music/getIsPusMusic',
            method: 'POST'
        })
    }


    /** 删除音乐 */
    static deleteMusic(goods_id: number) {
        return request<any, ResponseData>({
            url: '/deleteMusic',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 获取音乐详情信息 */
    static musicGetEditSDetail(goods_id: number) {
        return request<any, ResponseData>({
            url: '/music/getEditSDetail',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 编辑音乐信息 */
    static changeMusic(data: any) {
        return request<any, ResponseData>({
            url: '/changeMusic',
            method: 'POST',
            data
        })
    }

    static musicInfo(code: string) {
        return request<any, ResponseData>({
            url: '/music/info',
            method: 'POST',
            data: { code }
        })
    }

    /** 获取背景音乐 */
    static getBgMusicList(keyword?: string) {
        return request<any, ResponseData>({
            url: '/getBgMusicList',
            method: 'POST',
            data: { keyword }
        })
    }

    static tvideoToken(data: any) {
        return request<any, ResponseData>({
            url: '/tvideo/token',
            method: 'POST',
            data
        })
    }

    static tvideoInfo(code: string) {
        return request<any, ResponseData>({
            url: '/tvideo/info',
            method: 'POST',
            data: { code }
        })
    }

    /** 获取模板视频模块 */
    static getIsPushTvideo() {
        return request<any, ResponseData<any[]>>({
            url: '/tvideo/getIsPushVideo',
            method: 'POST'
        })
    }

    /** 模板视频详情 */
    static tvideoGetEditSDetail(goods_id: number) {
        return request<any, ResponseData>({
            url: '/tvideo/getEditSDetail',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 删除模板视频 */
    static deleteTemVideo(goods_id: number) {
        return request<any, ResponseData>({
            url: '/deleteTemVideo',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 获取模版对应下拉 */
    static getTemplateSelect(id: number) {
        return request<any, ResponseData>({
            url: '/tvideo/getTemplateSelect',
            method: 'POST',
            data: { id }
        })
    }

    /** 编辑模板视频信息 */
    static changeTemVideo(data: any) {
        return request<any, ResponseData>({
            url: '/changeTemVideo',
            method: 'POST',
            data
        })
    }

    static fontToken(data: any) {
        return request<any, ResponseData>({
            url: '/font/token',
            method: 'POST',
            data
        })
    }

    static getIsPushFont() {
        return request<any, ResponseData>({
            url: '/font/getIsPushPic',
            method: 'POST'
        })
    }

    /** 删除字体 */
    static deleteFont(goods_id: number) {
        return request<any, ResponseData>({
            url: '/deleteFont',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 字体详情 */
    static fontGetEditSDetail(goods_id: number) {
        return request<any, ResponseData>({
            url: '/font/getEditSDetail',
            method: 'POST',
            data: { goods_id }
        })
    }

    /** 编辑字体信息 */
    static changeFont(data: any) {
        return request<any, ResponseData>({
            url: '/changeFont',
            method: 'POST',
            data
        })
    }

}

export default APIUploadMaterial
